<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>校园心跳时刻 | 恋爱互动游戏</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: '微软雅黑', 'Arial', sans-serif;
        }
        body {
            min-height: 100vh;
            overflow: hidden;
            background: #f5f5f5;
        }
        /* 开场画面：屎黄色渐变背景 */
        .start-screen {
            position: fixed;
            top: 0;
            left: 0;
            width: 100vw;
            height: 100vh;
            background: linear-gradient(135deg, #f9d56e 0%, #d4a72c 100%);
            z-index: 30;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            text-align: center;
            padding: 20px;
            opacity: 1;
            transition: opacity 1s ease-out;
        }
        .start-title {
            font-size: 2.5rem;
            color: #7d5a00;
            margin-bottom: 20px;
            text-shadow: 0 2px 10px rgba(0,0,0,0.1);
            transform: translateY(30px);
            opacity: 0;
            animation: floatUp 1s forwards 0.5s;
        }
        .start-subtitle {
            font-size: 1.2rem;
            color: #9b7500;
            margin-bottom: 40px;
            transform: translateY(30px);
            opacity: 0;
            animation: floatUp 1s forwards 0.8s;
        }
        .start-btn {
            padding: 15px 30px;
            background: #d4a72c;
            color: #fff;
            border: none;
            border-radius: 30px;
            font-size: 1.1rem;
            cursor: pointer;
            box-shadow: 0 5px 15px rgba(212, 167, 44, 0.3);
            transform: translateY(30px) scale(0.9);
            opacity: 0;
            animation: floatUp 1s forwards 1.1s;
            transition: all 0.3s ease;
        }
        .start-btn:hover {
            transform: translateY(30px) scale(1);
            box-shadow: 0 8px 20px rgba(212, 167, 44, 0.4);
        }
        
        /* 全屏角色背景图 */
        .character-bg {
            position: fixed;
            top: 0;
            left: 0;
            width: 100vw;
            height: 100vh;
            z-index: -1;
        }
        .character-bg img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            filter: brightness(0.9);
            transition: all 1s ease-in-out;
        }
        
        /* 角色姓名显示 */
        .character-name {
            position: fixed;
            top: 30px;
            right: 30px;
            background: rgba(255, 255, 255, 0.8);
            backdrop-filter: blur(4px);
            padding: 8px 15px;
            border-radius: 20px;
            color: #555;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
            font-size: 1rem;
            opacity: 0;
            transition: opacity 0.5s ease 0.8s;
        }
        .character-name.show {
            opacity: 1;
        }
        
        /* 底部半透明交互框 */
        .interact-box {
            position: fixed;
            bottom: 0;
            left: 0;
            width: 100%;
            padding: 20px 15px;
            background: rgba(255, 255, 255, 0.6);
            backdrop-filter: blur(6px);
            border-top-left-radius: 16px;
            border-top-right-radius: 16px;
            box-shadow: 0 -3px 15px rgba(0,0,0,0.08);
            max-height: 50vh;
            overflow-y: auto;
            transform: translateY(100%); /* 初始隐藏 */
            transition: transform 0.5s ease;
        }
        .interact-box.show {
            transform: translateY(0); /* 显示交互框 */
        }
        
        /* 半透明对话框 - 打字机样式容器 */
        .dialog-box {
            background: rgba(240, 240, 240, 0.7);
            border-radius: 12px;
            padding: 15px;
            margin-bottom: 15px;
            border-left: 4px solid #d4a72c;
            opacity: 1;
            transform: translateY(0);
        }
        .dialog-text {
            font-size: 0.95rem;
            color: #333;
            line-height: 1.5;
            white-space: pre-wrap; /* 保留换行 */
            overflow: hidden;
            position: relative;
            min-height: 24px; /* 防止空容器塌陷 */
        }
        /* 打字机光标 */
        .dialog-text::after {
            content: "|";
            position: absolute;
            right: -5px;
            animation: blink 1s infinite;
        }
        .dialog-text.typed::after {
            display: none; /* 打字完成后隐藏光标 */
        }
        
        /* 半透明选项区 - 所有选项样式统一，无特殊标识 */
        .options-area {
            display: flex;
            flex-direction: column;
            gap: 10px;
            opacity: 0; /* 初始隐藏，打字完成后显示 */
            transition: opacity 0.5s ease;
        }
        .options-area.show {
            opacity: 1;
        }
        .option-btn {
            padding: 12px 15px;
            background: rgba(255, 255, 255, 0.5);
            border: 1px solid rgba(212, 167, 44, 0.4);
            border-radius: 8px;
            text-align: left;
            font-size: 0.9rem;
            color: #444;
            cursor: pointer;
            transition: all 0.2s ease;
            opacity: 0;
            transform: translateY(10px);
        }
        .option-btn:hover {
            background: rgba(255, 248, 220, 0.7);
            border-color: #d4a72c;
        }
        
        /* 好感度面板 */
        .progress-panel {
            position: fixed;
            top: 15px;
            left: 15px;
            background: rgba(255, 255, 255, 0.8);
            backdrop-filter: blur(4px);
            border-radius: 8px;
            padding: 8px 12px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.08);
            z-index: 10;
            opacity: 0; /* 初始隐藏 */
            transition: opacity 0.5s ease 0.3s;
        }
        .progress-panel.show {
            opacity: 1; /* 显示好感度面板 */
        }
        .progress-label {
            font-size: 0.8rem;
            color: #7d5a00;
            margin-bottom: 3px;
        }
        .progress-bar {
            height: 8px;
            background: #f9e6b3;
            border-radius: 4px;
            overflow: hidden;
            width: 120px;
        }
        .progress-fill {
            height: 100%;
            background: #d4a72c;
            width: 0%;
            transition: width 0.5s ease;
        }
        .progress-value {
            text-align: right;
            font-size: 0.8rem;
            color: #7d5a00;
            margin-top: 2px;
        }
        
        /* 结局页面 */
        .end-screen {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100vw;
            height: 100vh;
            background: rgba(255, 245, 204, 0.9);
            backdrop-filter: blur(8px);
            z-index: 20;
            padding: 30px 15px;
            text-align: center;
        }
        .end-screen.show {
            display: block;
            animation: fadeIn 1s forwards;
        }
        .end-title {
            font-size: 1.6rem;
            color: #7d5a00;
            margin-bottom: 15px;
            margin-top: 18vh;
            transform: translateY(20px);
            opacity: 0;
            animation: fadeIn 0.8s forwards 0.3s;
        }
        .end-desc {
            font-size: 1rem;
            color: #555;
            margin-bottom: 25px;
            line-height: 1.6;
            max-width: 500px;
            margin-left: auto;
            margin-right: auto;
            transform: translateY(20px);
            opacity: 1; /* 确保初始可见 */
            white-space: pre-wrap;
            position: relative;
            text-align: left; /* 与对话文本对齐 */
            padding: 0 10px;
            min-height: 48px; /* 防止空容器塌陷 */
        }
        /* 结局文本光标 */
        .end-desc::after {
            content: "|";
            position: absolute;
            right: -5px;
            animation: blink 1s infinite;
        }
        .end-desc.typed::after {
            display: none;
        }
        .restart-btn {
            padding: 12px 25px;
            background: #d4a72c;
            color: #fff;
            border: none;
            border-radius: 8px;
            font-size: 1rem;
            cursor: pointer;
            transform: translateY(20px);
            opacity: 0;
            transition: all 0.3s ease;
        }
        .restart-btn.show {
            animation: fadeIn 0.8s forwards;
        }
        
        /* 动画效果 */
        @keyframes fadeIn {
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        @keyframes floatUp {
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        @keyframes blink {
            0%, 100% { opacity: 1; }
            50% { opacity: 0; }
        }
        
        /* 爱心特效 */
        .heart {
            position: absolute;
            width: 20px;
            height: 20px;
            background-color: #e74c3c;
            transform: rotate(45deg);
            animation: heartFloat 3s ease-in-out forwards;
            opacity: 0;
            z-index: 15;
        }
        .heart:before, .heart:after {
            content: '';
            position: absolute;
            width: 20px;
            height: 20px;
            background-color: #e74c3c;
            border-radius: 50%;
        }
        .heart:before {
            top: -10px;
            left: 0;
        }
        .heart:after {
            top: 0;
            left: -10px;
        }
        @keyframes heartFloat {
            0% {
                transform: rotate(45deg) translateY(0) scale(0.5);
                opacity: 0.8;
            }
            100% {
                transform: rotate(45deg) translateY(-100vh) scale(1.2);
                opacity: 0;
            }
        }
        
        /* 漂浮大便特效 */
        .poop {
            position: absolute;
            font-size: 24px;
            opacity: 0;
            z-index: 14;
            animation: poopFloat 10s linear forwards;
        }
        @keyframes poopFloat {
            0% {
                transform: translateY(-50px) rotate(0deg);
                opacity: 0.8;
            }
            100% {
                transform: translateY(100vh) rotate(360deg);
                opacity: 0;
            }
        }
    </style>
</head>
<body>
    <!-- 开场画面（初始显示） -->
    <div class="start-screen" id="start-screen">
        <h1 class="start-title">校园心跳时刻</h1>
        <p class="start-subtitle">与艾潇涵的青春恋爱物语</p>
        <button class="start-btn" id="start-btn">开始攻略</button>
    </div>
    <!-- 全屏角色背景图 -->
    <div class="character-bg" id="character-bg">
        <!-- 游戏初始默认背景图（使用normal情绪图） -->
        <img src="https://s21.ax1x.com/2025/11/10/pZ90git.jpg" alt="艾潇涵" id="character-img">
    </div>
    <!-- 角色姓名显示 -->
    <div class="character-name" id="character-name">艾潇涵</div>
    <div class="progress-panel" id="progress-panel">
        <div class="progress-label">好感度</div>
        <div class="progress-bar">
            <div class="progress-fill" id="progress-fill"></div>
        </div>
        <div class="progress-value" id="progress-value">50/100</div>
    </div>
    <div class="interact-box" id="interact-box">
        <div class="dialog-box">
            <div class="dialog-text" id="dialog-text"></div>
        </div>
        <div class="options-area" id="options-area">
            <!-- 选项动态生成 -->
        </div>
    </div>
    <div class="end-screen" id="end-screen">
        <h2 class="end-title" id="end-title">游戏结束</h2>
        <p class="end-desc" id="end-desc"></p>
        <button class="restart-btn" id="restart-btn">再来一次</button>
    </div>
    <script>
        // 角色信息：姓名+5种情绪图片
        const characterInfo = {
            name: "艾潇涵",
            imgs: {
                normal: "https://s21.ax1x.com/2025/11/10/pZ90git.jpg", // 1. 普通/中性情绪
                happy: "https://s21.ax1x.com/2025/11/10/pZ902JP.jpg",   // 2. 开心情绪
                shy: "https://s21.ax1x.com/2025/11/10/pZ90Wz8.jpg",    // 3. 害羞情绪
                awkward: "https://s21.ax1x.com/2025/11/10/pZ90hQS.jpg", // 4. 尴尬/沮丧情绪
                angry: "https://s21.ax1x.com/2025/11/10/pZ9wtgS.jpg"    // 5. 生气情绪
            }
        };
        // 10个问题，隐性扣分机制（对话中添加姓名“艾潇涵”）
        const questions = [
            {
                dialog: "（课间休息时，艾潇涵抱着书本坐到你旁边）“数学课TM难”",
                options: [
                    { text: "“不难啊，人和人是有差距的”", score: -3 }, // 隐性扣分
                    { text: "“对🐖来说还是太深奥了”", score: -5 }, // 隐性扣分
                    { text: "“你不太行啊”", score: 8 },
                    { text: "“确实难！”", score: 10 },
                    { text: "“多练吧”", score: 7 }
                ],
                img: "normal"
            },
            {
                dialog: "（午休时，艾潇涵拿着面包走到你桌边）“嗟，来食”",
                options: [
                    { text: "“不吃猪饲料，自己留着吧”", score: -4 }, // 隐性扣分
                    { text: "“哦”（把面包丢了没再说话）", score: 2 },
                    { text: "“拿来吧你”", score: 9 },
                    { text: "“那我下次请你喝奶茶”", score: 10 },
                    { text: "“君子不吃嗟来之食~”", score: 8 }
                ],
                img: "shy"
            },
            {
                dialog: "（体育课自由活动，艾潇涵坐在操场边，要累死了）“MD，1000米怎么那么累？”",
                options: [
                    { text: "“还好吧，你好菜啊”", score: -2 }, // 隐性扣分
                    { text: "“天生的呗，🐖是这样的。”（转身准备离开）", score: -6 }, // 隐性扣分
                    { text: "“你不行啊”", score: 8 },
                    { text: "“你跑完就不错了”", score: 10 },
                    { text: "“笑死我了，你体力那么差”", score: 7 }
                ],
                img: "happy"
            },
            {
                dialog: "（自习课，艾潇涵偷偷传纸条给你）“下节课要听写英语单词，你复习了吗？”",
                options: [
                    { text: "“老子不复习也过，不像你这种废物。”", score: -5 }, // 隐性扣分
                    { text: "“关你屁事。”", score: 3 },
                    { text: "“复习了”", score: 9 },
                    { text: "“我也没太熟", score: 8 },
                    { text: "“行，一会给你看”", score: 10 }
                ],
                img: "awkward"
            },
            {
                dialog: "（放学路上，艾潇涵追上你）“我自行车坏了，带我回去”",
                options: [
                    { text: "“我的车不运货~”", score: -8 }, // 隐性扣分
                    { text: "“肥猪滚一边去。”", score: -3 }, // 隐性扣分
                    { text: "“哦”", score: 8 },
                    { text: "“附近有修车的”", score: 10 },
                    { text: "“呃，勉为其难了~”", score: 9 }
                ],
                img: "normal"
            },
            {
                dialog: "（艾潇涵把奶茶洒在你衣服上）“谁让你在这了，活该”",
                options: [
                    { text: "“你有病啊”", score: 2 },
                    { text: "给他吃巴掌", score: -4 }, // 隐性扣分
                    { text: "“没关系我回家洗一下就好”", score: 10 },
                    { text: "“没事~”（笑着摆手）", score: 8 },
                    { text: "“呜呜呜”", score: 9 }
                ],
                img: "awkward"
            },
            {
                dialog: "（周末在书店偶遇艾潇涵）“卧槽，怎么是你？”",
                options: [
                    { text: "“我不能来吗，书店你家开的？”", score: -3 }, // 隐性扣分
                    { text: "“我买书关你屁事？”", score: 4 },
                    { text: "“怎么了？”", score: 8 },
                    { text: "“你来干什么？”", score: 10 },
                    { text: "“嗯？”", score: 7 }
                ],
                img: "shy"
            },
            {
                dialog: "（艾潇涵拿着运动会报名表）“那个…我报了10米赛跑，你能当我们班的啦啦队吗？”",
                options: [
                    { text: "“滚。”", score: -5 }, // 隐性扣分
                    { text: "“可以啊，V我50。”", score: -2 },
                    { text: "“我知道🐖怎么跑，免了！”", score: -8 },
                    { text: "“好的”", score: 10 },
                    { text: "“嗯”", score: 9 }
                ],
                img: "happy"
            },
            {
                dialog: "（期中考试后，艾潇涵考了200分）“这TM什么破题目，我本来能考700”",
                options: [
                    { text: "“一般般吧。”", score: 5 },
                    { text: "“确实，题目好一点你能更好”", score: 7 },
                    { text: "“考200，你跟我们是一种生物吗？”", score: -7 }, // 隐性扣分
                    { text: "“就是题目有问题，我们去找老师！”", score: 10 },
                    { text: "“就是说，这次是什么破题？”", score: 9 }
                ],
                img: "awkward"
            },
            {
                dialog: "（毕业前最后一天，艾潇涵递给你一封信）“这是给你的…爱看不看。”",
                options: [
                    { text: "“哦。”", score: 3 },
                    { text: "把信塞他嘴里“看nm”", score: -4 }, // 隐性扣分
                    { text: "“AUV~我看看怎么个事”", score: 0 },
                    { text: "“谢谢嗷，我看看，有心了”", score: 10 },
                    { text: "“好，我看看”", score: 9 }
                ],
                img: "shy"
            }
        ];
        // 全局元素获取
        const startScreen = document.getElementById('start-screen');
        const startBtn = document.getElementById('start-btn');
        const characterName = document.getElementById('character-name');
        const progressPanel = document.getElementById('progress-panel');
        const progressFill = document.getElementById('progress-fill');
        const progressValue = document.getElementById('progress-value');
        const interactBox = document.getElementById('interact-box');
        const dialogText = document.getElementById('dialog-text');
        const optionsArea = document.getElementById('options-area');
        const endScreen = document.getElementById('end-screen');
        const endTitle = document.getElementById('end-title');
        const endDesc = document.getElementById('end-desc');
        const restartBtn = document.getElementById('restart-btn');
        const characterImg = document.getElementById('character-img');
        
        // 游戏状态变量
        let currentQuestion = 0;
        let favorability = 50; // 初始好感度50分
        let poopInterval = null; // 大便特效定时器（用于重置）
        const typeSpeed = 50; // 打字速度（毫秒/字）
        const typeVolume = 0.2; // 打字音效音量（0-1）
        
        // 初始化打字音效（使用Web Audio API生成键盘敲击声，无需外部音频文件）
        function createTypeSound() {
            const audioContext = new (window.AudioContext || window.webkitAudioContext)();
            return function playTypeSound() {
                const oscillator = audioContext.createOscillator();
                const gainNode = audioContext.createGain();
                
                oscillator.type = 'sine';
                oscillator.frequency.setValueAtTime(600, audioContext.currentTime);
                oscillator.frequency.exponentialRampToValueAtTime(50, audioContext.currentTime + 0.1);
                
                gainNode.gain.setValueAtTime(0, audioContext.currentTime);
                gainNode.gain.linearRampToValueAtTime(typeVolume, audioContext.currentTime + 0.02);
                gainNode.gain.linearRampToValueAtTime(0, audioContext.currentTime + 0.1);
                
                oscillator.connect(gainNode);
                gainNode.connect(audioContext.destination);
                
                oscillator.start();
                oscillator.stop(audioContext.currentTime + 0.1);
            };
        }
        const playTypeSound = createTypeSound(); // 生成打字音效播放函数
        
        // 修复后的打字机函数：添加打字音效
        function typeWriter(element, text, callback = () => {}) {
            element.textContent = ""; // 清空内容
            element.classList.remove('typed');
            
            // 兼容空文本（防止报错）
            if (!text || text.length === 0) {
                element.classList.add('typed');
                callback();
                return;
            }
            
            let index = 0;
            const typingInterval = setInterval(() => {
                if (index < text.length) {
                    element.textContent += text.charAt(index);
                    playTypeSound(); // 每打一个字播放一次音效
                    index++;
                } else {
                    clearInterval(typingInterval);
                    element.classList.add('typed');
                    callback(); // 打字完成后执行回调
                }
            }, typeSpeed);
        }
        
        // 初始化游戏（页面加载时执行）
        function initGame() {
            // 重置游戏状态
            currentQuestion = 0;
            favorability = 50;
            // 隐藏交互框、好感度面板、结局页、姓名显示，显示开场页
            interactBox.classList.remove('show');
            progressPanel.classList.remove('show');
            characterName.classList.remove('show');
            endScreen.classList.remove('show');
            restartBtn.classList.remove('show');
            startScreen.style.opacity = '1';
            startScreen.style.display = 'flex';
            // 停止大便特效（防止重复生成）
            if (poopInterval) clearInterval(poopInterval);
            // 重置进度条
            progressFill.style.width = '50%';
            progressValue.textContent = '50/100';
            // 重置角色图片为初始图（normal情绪）
            characterImg.src = characterInfo.imgs.normal;
        }
        
        // 开始游戏按钮事件
        startBtn.addEventListener('click', () => {
            startScreen.style.opacity = '0';
            setTimeout(() => {
                startScreen.style.display = 'none';
                progressPanel.classList.add('show');
                characterName.classList.add('show'); // 显示角色姓名
                interactBox.classList.add('show');
                startPoopRain(); // 启动漂浮大便特效
                initQuestion(); // 加载第一个问题
            }, 1000);
        });
        
        // 加载当前问题
        function initQuestion() {
            const q = questions[currentQuestion];
            // 背景图切换动画
            characterImg.style.opacity = '0.5';
            setTimeout(() => {
                characterImg.src = characterInfo.imgs[q.img];
                characterImg.style.opacity = '1';
            }, 500);
            
            // 清空选项区
            optionsArea.innerHTML = '';
            optionsArea.classList.remove('show');
            
            // 打字机效果显示对话，完成后显示选项
            typeWriter(dialogText, q.dialog, () => {
                optionsArea.classList.add('show');
                // 生成选项（统一样式）
                q.options.forEach((option, index) => {
                    const btn = document.createElement('button');
                    btn.className = 'option-btn';
                    btn.textContent = option.text;
                    btn.addEventListener('click', () => selectOption(option.score));
                    optionsArea.appendChild(btn);
                    
                    // 依次显示选项
                    setTimeout(() => {
                        btn.style.animation = 'fadeIn 0.5s forwards ' + (index * 0.1) + 's';
                    }, 300);
                });
            });
        }
        
        // 选择选项后的处理
        function selectOption(score) {
            // 加分特效
            if (score > 5) {
                createHearts(3 + Math.floor(score / 2));
            }
            
            // 计算好感度（0~100区间）
            favorability = Math.max(0, Math.min(100, favorability + score));
            progressFill.style.width = `${favorability}%`;
            progressValue.textContent = `${favorability}/100`;
            
            // 禁用所有选项
            const buttons = document.querySelectorAll('.option-btn');
            buttons.forEach(btn => {
                btn.disabled = true;
                btn.style.opacity = '0.5';
            });
            
            // 进入下一题或结局
            currentQuestion++;
            if (currentQuestion < questions.length) {
                setTimeout(initQuestion, 1200);
            } else {
                setTimeout(showEnding, 1200);
            }
        }
        
        // 修复后的结局显示函数：打字机效果+音效
        function showEnding() {
            interactBox.classList.remove('show');
            progressPanel.classList.remove('show');
            characterName.classList.remove('show');
            endScreen.classList.add('show');
            restartBtn.classList.remove('show');
            
            let endText = "";
            // 根据好感度设置结局文案（确保文本非空）
            if (favorability < 30) {
                endTitle.textContent = "厌恶至极";
                endText = "艾潇涵冲过来把你狠狠揍了一顿,你tm是故意找茬吗";
                characterImg.src = characterInfo.imgs.angry;
            } else if (favorability < 50) {
                endTitle.textContent = "形同陌路";
                endText = "“我看你就不顺眼”艾潇涵这样子说并且对你吐了口痰";
                characterImg.src = characterInfo.imgs.normal;
            } else if (favorability < 70) {
                endTitle.textContent = "普通朋友";
                endText = "艾潇涵对你比了一个中指“一边去”";
                characterImg.src = characterInfo.imgs.awkward;
            } else if (favorability < 90) {
                endTitle.textContent = "艾潇涵并不讨厌你";
                endText = "“哎呦不错哦”艾潇涵给你竖了个大拇指";
                characterImg.src = characterInfo.imgs.happy;
                createHearts(20);
            } else {
                endTitle.textContent = "攻略成功咯";
                endText = "“mua”艾潇涵投来一个飞吻 恭喜你游戏成功";
                characterImg.src = characterInfo.imgs.happy;
                createHearts(30);
            }
            
            // 确保结局文本容器可见，立即触发打字机效果（带音效）
            setTimeout(() => {
                typeWriter(endDesc, endText, () => {
                    restartBtn.classList.add('show');
                });
            }, 500); // 延迟500ms，确保结局页完全显示
        }
        
        // 再来一次按钮事件（核心修复：调用初始化函数，回到开场页）
        restartBtn.addEventListener('click', initGame);
        
        // 创建爱心特效
        function createHearts(count) {
            for (let i = 0; i < count; i++) {
                const heart = document.createElement('div');
                heart.className = 'heart';
                heart.style.left = Math.random() * 100 + 'vw';
                heart.style.top = Math.random() * 50 + 30 + 'vh';
                heart.style.width = Math.random() * 15 + 10 + 'px';
                heart.style.height = heart.style.width;
                heart.style.animationDelay = Math.random() * 2 + 's';
                heart.style.animationDuration = Math.random() * 3 + 2 + 's';
                document.body.appendChild(heart);
                setTimeout(() => heart.remove(), 5000);
            }
        }
        
        // 创建漂浮大便特效
        function createPoop() {
            const poop = document.createElement('div');
            poop.className = 'poop';
            poop.innerHTML = '💩';
            poop.style.left = Math.random() * 100 + 'vw';
            poop.style.top = -30 + 'px';
            poop.style.fontSize = Math.random() * 20 + 20 + 'px';
            poop.style.animationDelay = Math.random() * 2 + 's';
            poop.style.animationDuration = Math.random() * 15 + 10 + 's';
            document.body.appendChild(poop);
            setTimeout(() => poop.remove(), 25000);
        }
        
        // 持续生成漂浮大便
        function startPoopRain() {
            createPoop();
            poopInterval = setInterval(createPoop, 3000); // 保存定时器ID，用于重置
        }
        
        // 页面加载完成后初始化游戏
        window.onload = initGame;
    </script>
</body>
</html>